﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using MotoGame.Estados.Menu;

namespace MotoGame.Estados.Intro
{
    class Intro:EstadoBase
    {
        KeyboardState teclado_atual;
        SpriteFont arial;
        Texture2D background;

        int time = 0;

        public Intro(MainGame game) :base(game)
        {
            background = Game.Content.Load<Texture2D>("intro-bg");
            arial = Game.Content.Load<SpriteFont>("arial");
        }

        public override void Start()
        {
            time = 0;
        }

        public override void Update(GameTime gameTime)
        {
            time += gameTime.ElapsedGameTime.Milliseconds;
            
            teclado_atual = Keyboard.GetState();

            if (teclado_atual.IsKeyDown(Keys.Enter) || time >= 5000) 
            {
                Game.StateManager.GoTo(MainGame.Estado.Menu);
            }
        }

        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(background, new Rectangle(0, 0, Game.Window.ClientBounds.Width, Game.Window.ClientBounds.Height), Color.White);

            spriteBatch.DrawString(arial, "Tempo (ms): " + time, new Vector2(10, 10), Color.Red);
        }
    }
}
